﻿using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using LeanBoard.Models;

namespace LeanBoard.Controllers
{
    class OfflineChangeRequestsProvider : IProvideChangeRequests
    {
        private const string _path = @"C:\workspace\LeanBoard\_branch\v.0.1\LeanBoard\LeanBoard\Controllers\board.txt";

        public ItemsCollection GetItemsForTheLeanBoard()
        {
            BinaryFormatter bFormatter = new BinaryFormatter();
            Stream stream = File.Open(_path, FileMode.Open);
            ItemsCollection itemsCollection = bFormatter.Deserialize(stream) as ItemsCollection;
            stream.Close();
            return itemsCollection;
        }
    }
}